package leecode

func lowestCommonAncestor2(root, p, q *TreeNode) *TreeNode {
	value := root.Val
	if p.Val < value && q.Val < value {
		return lowestCommonAncestor2(root.Left, p, q)
	}
	if p.Val > value && q.Val > value {
		return lowestCommonAncestor2(root.Right, p, q)
	}
	//相等
	return root
}
